package com.ciaojian.worker.model.param;

import cn.hutool.core.bean.BeanUtil;
import com.ciaojian.core.model.UserAppraise;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

/**
 * @author oxiny
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Accessors(chain = true)
public class SaveUserLabelDTO extends BaseDTO<UserAppraise> {
    @ApiModelProperty("用户ID")
    @NotNull(message = "用户ID不能为空")
    private Integer userId;

    @ApiModelProperty("标签字符串, 以JSON格式存储")
    private String labelStr;

    public UserAppraise convert() {
        UserAppraise userAppraise = UserAppraise.builder().build();
        BeanUtil.copyProperties(this, userAppraise);
        return userAppraise;
    }
}
